package com.wmm.common.enums;

import java.util.HashMap;
import java.util.Map;
/**
 * @author yuri
 *	2018年1月23日	上午10:41:10
 */
public enum EWarning {
	Unknown(1000,"未知错误"),
	ErrorParams(1001,"参数错误"),
	GoodsNotExists(1002,"商品不存在"),
	GoodsNotEnough(1003,"库存不足"),
    Busy(1004,"网络繁忙"),
    UserNotExists(1005,"用户不存在"),
    UserAndPwdNotMatchs(1006,"账号密码不匹配"),
    UserAlreadyExists(1007,"用户账号已存在")
	;
    protected int value;
    protected String name;

    private EWarning(int value, String name){
        this.name=name;
        this.value=value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

	private static Map<Integer,EWarning> map = new HashMap<Integer,EWarning>();
	static{
		for (EWarning warning : EWarning.values()) {
			map.put(warning.getValue(), warning);
		}
	}
	
	public static EWarning get(Integer value) {
		return map.get(value);
	}
}
